package com.springboot.erp.service.impl;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.erp.entity.JshDepot;
import com.springboot.erp.mapper.JshDepotMapper;
import com.springboot.erp.service.JshDepotService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service

public class JshDepotServiceImpl implements JshDepotService {
    @Resource
    private JshDepotMapper jshDepotMapper;
    @Override
    public Page<JshDepot> selectForPagesDI(String name,
                                           String remark,
                                           int current, int size, String orderBy, boolean asc) {
        Page<JshDepot> page = new Page<>(current, size);
        OrderItem orderItem = new OrderItem().setColumn(orderBy).setAsc(asc);
        page.addOrder(orderItem);
        page = jshDepotMapper.selectForPagesD(name, remark, page);
        return page;
    }

    @Override
    public void addOne(JshDepot jshDepot) {
        jshDepotMapper.insrtOneD(jshDepot);

    }

    @Override
    public void updateOne(JshDepot jshDepot) {
        jshDepotMapper.updateOneD(jshDepot);

    }

    @Override
    public void deleteOne(Integer id) {
        jshDepotMapper.deleteOneD(id);

    }
}
